<?php include_once($_SERVER['DOCUMENT_ROOT']."/controller/common/common_setting_unit.php"); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <?php include ROOT_PATH_.'/controller/common/module/head.php'; ?>
    <!--kindeditor编辑器-->
    <?php include_once(TASK_PATH_.'/mod-nkeditor.php'); ?>
</head>
<style>
    html{
        background: #fff;
    }
    #content{
        margin: 0;
    }
    .detail-box{
        
        margin: 0px 0 70px 0;
    }
    .detail-box .function{
        margin-left: 0;
    }
</style>
<body>
<div id="content">
    <?php $page_title='新增任务';?>
    <?php include ROOT_PATH_.'/controller/common/module/mod-page-title.php'; ?>

    <form id="add-task-form" method="post"
        action="../detail-add-function.php?sys_part=task"
        enctype="multipart/form-data" class="layui-form detail-box">

            <div class="layui-form-item">
                <label class="layui-form-label">任务标题</label>
                <div class="layui-input-block">
                    <input type="text" name="ai_title" lay-verify="required" placeholder="请输入任务标题" autocomplete="off" class="layui-input" value="">
                </div>
            </div>

            <?
                $agean_list=select_lines_all_items($table_Prefix."employee","nid desc","status = '在职'","0");
            ?>
            <div class="layui-form-item">
                <label class="layui-form-label">执行人</label>
                <div class="layui-input-block">
                    <select name="ai_principal" lay-search="">
                        <option value=""></option>
                        <? for($i=0;$i<count($agean_list);$i++){ ?>
                            <option value="<? echo $agean_list[$i]['nid'] ?>" <?php if($_SESSION['nid'] == $agean_list[$i]['nid']){echo "selected";} ?>><? echo $agean_list[$i]['nid'] ?> : <? echo $agean_list[$i]['name'] ?></option>
                        <? } ?>
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">开始时间</label>
                <div class="layui-input-block">
                    <input type="text" name="ai_startdate" id="start_date" autocomplete="off" class="layui-input" class="laydate-icon" placeholder="请选择开始时间">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">截止时间</label>
                <div class="layui-input-block">
                    <input type="text" name="ai_enddate" id="end_date" autocomplete="off" class="layui-input" class="laydate-icon" placeholder="请选择截止时间">
                </div>
            </div>

            <?
                $case_list=select_lines_all_items($table_Prefix."case","FIELD(status, '询价中', '进行中', '完成','客户终止') ,startdate desc,nid desc","","0");
                //获取要用到的单位名字
                $unit_nid_list=transform_2darray_in_1darray_with_new_key($case_list,"nid","unit");
                $unit_nid_list_str=implode("','",$unit_nid_list);
                $unit_list=select_lines_all_items($table_Prefix."unit","","nid in ('".$unit_nid_list_str."')","");
                $unit_name_list=transform_2darray_in_1darray_with_new_key($unit_list,"nid","sname");
            ?>

            <div class="layui-form-item">
                <label class="layui-form-label">项目</label>
                <div class="layui-input-block">
                    <select name="ai_case_id" lay-search="" >
                        <option value="">无</option>
                        <? for($i=0;$i<count($case_list);$i++){ ?>
                            <option value="<? echo $case_list[$i]['nid'] ?>"><? echo $case_list[$i]['nid'] ?> :【<?echo $unit_name_list[$case_list[$i]['unit']]?>】<? echo $case_list[$i]['name'] ?>-<?echo $case_list[$i]['status']?></option>
                        <? } ?>
                    </select>
                </div>
            </div>

            <!-- <div class="layui-form-item">
                <label class="layui-form-label">凭证</label>
                <div class="layui-input-block">
                    <textarea id="ai_voucher" name="ai_voucher" cols="100"></textarea>
                </div>
            </div> -->

            <div class="layui-form-item">
                <label class="layui-form-label">备注</label>
                <div class="layui-input-block">
                    <textarea id="ai_note" name="ai_note" cols="100"></textarea>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">优先级</label>
                <div class="layui-input-block">
                    <input type="radio" name="ai_priority" value="无" title="无" >
                    <input type="radio" name="ai_priority" value="普通" title="普通" checked="checked">
                    <input type="radio" name="ai_priority" value="紧急" title="紧急" >
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">状态</label>
                <div class="layui-input-block">
                    <input type="radio" name="ai_status" value="未开始" title="未开始" checked="checked">
                    <input type="radio" name="ai_status" value="进行中" title="进行中">
                    <input type="radio" name="ai_status" value="待审核" title="待审核">
                    <?php if ($auth): ?>
                        <input type="radio" name="ai_status" value="已完成" title="已完成">
                    <?php endif; ?>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">任务重复</label>
                <div class="layui-input-block">
                    <input type="radio" name="ai_circulate" value="不重复" title="不重复" checked="checked">
                    <input type="radio" name="ai_circulate" value="每天重复" title="每天重复">
                    <input type="radio" name="ai_circulate" value="每周重复" title="每周重复">
                    <input type="radio" name="ai_circulate" value="每月重复" title="每月重复">
                    <input type="radio" name="ai_circulate" value="季度重复" title="季度重复">
                    <input type="radio" name="ai_circulate" value="每年重复" title="每年重复">
                    <div class="layui-col-md12">
                        <div class="notice">当任务状态被更改为已完成时，按任务的重复周期自动创建新任务，默认为不重复</div>
                    </div>
                </div>
            </div>

            <input name="sys_part" type="hidden" value="<? echo $system_part ?>"/>
            <input name="nowpageid" type="hidden" value="<? echo $_REQUEST['nowpageid'] ?>"/>
            <input name="sortby" type="hidden" value="<? echo $_REQUEST['sortby'] ?>"/>

        <div class="function">
            <button class="layui-btn" lay-submit lay-filter="formTaskBtn" type="buttom" id="taskBtn">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </form>
</div>
</body>
<script src="../../asset/js/date.js?version=2023"></script>
</html>